//
//  KMActionSheet.m
//  YuanHeLife
//
//  Created by cnmobi on 15/7/9.
//  Copyright (c) 2015年 CNMOBI. All rights reserved.
//

#import "KMActionSheet.h"

@implementation KMActionSheet
{
    KMActionSheetClickBtnBlock block;
    
}

- (id)initWithTitle:(NSString *)titleStr cancelButtonTitle:(NSString *)cancelStr destructiveButtonTitle:(NSString *)desTitle otherButtonTitles:(NSArray *)otherArray andClickButton:(KMActionSheetClickBtnBlock)clickBtnBlock
{
    
    self = [super initWithTitle:titleStr delegate:self cancelButtonTitle:cancelStr destructiveButtonTitle:desTitle otherButtonTitles:nil,nil];
    
    for (NSString *title in otherArray) {
        [self addButtonWithTitle:title];
        
    }
    
    
    if (block!=nil) {
        block=nil;
    }
    if (clickBtnBlock) {
        block=clickBtnBlock;
    }

    
    return self;
}



- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
    //
    block(buttonIndex);
    
}

@end
